package com.jixiantubu.jinnang;

import com.example.jixiantubu.R;

import android.app.Activity;
import android.app.Fragment;
import android.graphics.Shader.TileMode;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.RadioButton;
import android.widget.TextView;

public class TopByJinNangFragment extends Fragment {
	TextView  t6;
	ICallBack1 iCallBack1;
	RadioButton t4, t5;
	public interface ICallBack1 {
		// title表示传给中间碎片的文本，alg标志是哪个模块传的
		public void danamicLoad1(String title, int flag);

	}

	@Override
	public void onAttach(Activity activity) {
		// TODO Auto-generated method stub
		super.onAttach(activity);
		iCallBack1 = (ICallBack1) activity;
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View view = inflater.inflate(R.layout.topbarbyjinnang, null);
		t4 = (RadioButton) view.findViewById(R.id.kepu);
		t5 = (RadioButton) view.findViewById(R.id.tuijian);
		t6 = (TextView) view.findViewById(R.id.youji);
		setlistener();
		return view;
	}

	private void setlistener() {
		// 监听TextView单击事件
		t4.setOnClickListener(onClickListener);
		t5.setOnClickListener(onClickListener);
		t6.setOnClickListener(onClickListener);
	}

	OnClickListener onClickListener = new OnClickListener() {

		@Override
		public void onClick(View arg0) {
			switch (arg0.getId()) {
			case R.id.kepu:
				iCallBack1.danamicLoad1("科普", 2);
				break;
			case R.id.tuijian:
				iCallBack1.danamicLoad1("推荐", 7);
				break;
			case R.id.youji:
				iCallBack1.danamicLoad1("游记", 8);
				
				break;
			default:
				break;
			}

		}
	};
}
